<template>
  <div class="analyze">
    <div class="box">
      <div class="main" id="main"></div>
    </div>
  </div>
</template>

<script>
import * as echarts from 'echarts';
export default {
  name: "analyzeView",
  created() {

  },

  mounted() {
    this.init()
  },

  methods: {
    init() {
      // 基于准备好的dom，初始化echarts实例
      var myChart = echarts.init(document.getElementById('main'));
      // 绘制图表
      myChart.setOption({
        tooltip: {
          trigger: 'item'
        },
        series: [
          {
            name: '物品占比',
            type: 'pie',
            label: {
              show: false
            },
            data: [
              { value: 2, name: '食物' },
              { value: 3, name: '日用品' },
              { value: 1, name: '图书' },
              { value: 1, name: '衣服' },
              { value: 1, name: '其他' },
              { value: 1, name: '化妆品' }
            ],
          }
        ]
      });
    }
  },

}
</script>

<style lang="less" scoped>
.box {
  display:flex;
  justify-content: center;
  align-items: center;
  .main {
    width: 800px;
    height: 800px;
  }
}
</style>
